﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZHDJ.Data.DataCaching;
using ZHDJ.WebPage.Master;

namespace ZHDJ.Web.PortalParts
{
    public partial class PageMorePublicity : MorePageMaster
    {

        protected void Page_Load(object sender, EventArgs e)
        {

            LoadData();

        }

        /// <summary>
        /// 加载
        /// </summary>
        public void LoadData()
        {
            if (string.IsNullOrEmpty(Module))
            {
                //Response.Redirect("~/default.aspx");
                RedirectToDefault();
            }

            var moduleQuery = PartyModuleNavigationCaching.Get("JoinPartyPublicity");

            var m = moduleQuery.FirstOrDefault(a => string.IsNullOrEmpty(a.Category));
            if (m == null)
            {
                //Response.Redirect("~/default.aspx");
                RedirectToDefault();
            }
            litModuleName.Text = ModuleName = m.PageName;
            var q = moduleQuery.Where(a => a.Enabled && !string.IsNullOrEmpty(a.Category));
            rptPage.DataSource = q.ToList();
            rptPage.DataBind();

            hdCategory.Value = Category;

            //加载组织关系转移公示
            var moduleQueryZY = PartyModuleNavigationCaching.Get("RelationShippublicity");
            var mZY = moduleQueryZY.FirstOrDefault(a => string.IsNullOrEmpty(a.Category));
            if (mZY == null)
            {
                //Response.Redirect("~/default.aspx");
                RedirectToDefault();
            }
            litModuleNameZY.Text = mZY.PageName;
            var qZY = moduleQueryZY.Where(a => a.Enabled && !string.IsNullOrEmpty(a.Category));
            rptPageZY.DataSource = qZY.ToList();
            rptPageZY.DataBind();
        }

    }
}